package com.lqm.web.controller.home;

import com.lqm.entity.home.HomeUser;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;

/**
 * @program: CrowdFunding
 * @description
 * @author: lqm
 * @create: 2018-12-12 21:26
 */
@RestController
@RequestMapping("home")
public class IndexController {

    @RequestMapping("getCurrentUser")
    public Map<String, Object> getCurrentUser(HttpSession session) {
        HashMap<String, Object> map = new HashMap<String, Object>();
        if (session.getAttribute("home_user")!=null){
            map.put("code",0);
            map.put("msg","登录成功");
            map.put("data",session.getAttribute("home_user"));
        }else {
            map.put("code",101);
            map.put("msg","当前没有登录！");
        }

        return map;
    }
}
